import 'package:wanxiang_app/generated/json/base/json_convert_content.dart';
import 'package:wanxiang_app/bean/group_list_entity.dart';

GroupListEntity $GroupListEntityFromJson(Map<String, dynamic> json) {
  final GroupListEntity groupListEntity = GroupListEntity();
  final String? name = jsonConvert.convert<String>(json['name']);
  if (name != null) {
    groupListEntity.name = name;
  }
  final String? photo = jsonConvert.convert<String>(json['photo']);
  if (photo != null) {
    groupListEntity.photo = photo;
  }
  final String? account = jsonConvert.convert<String>(json['account']);
  if (account != null) {
    groupListEntity.account = account;
  }
  final String? lastmsg = jsonConvert.convert<String>(json['lastmsg']);
  if (lastmsg != null) {
    groupListEntity.lastmsg = lastmsg;
  }
  final String? time = jsonConvert.convert<String>(json['time']);
  if (time != null) {
    groupListEntity.time = time;
  }
  final int? time2 = jsonConvert.convert<int>(json['time2']);
  if (time2 != null) {
    groupListEntity.time2 = time2;
  }
  final String? sessionId = jsonConvert.convert<String>(json['sessionId']);
  if (sessionId != null) {
    groupListEntity.sessionId = sessionId;
  }
  final int? unread = jsonConvert.convert<int>(json['unread']);
  if (unread != null) {
    groupListEntity.unread = unread;
  }
  return groupListEntity;
}

Map<String, dynamic> $GroupListEntityToJson(GroupListEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['name'] = entity.name;
  data['photo'] = entity.photo;
  data['account'] = entity.account;
  data['lastmsg'] = entity.lastmsg;
  data['time'] = entity.time;
  data['time2'] = entity.time2;
  data['sessionId'] = entity.sessionId;
  data['unread'] = entity.unread;
  return data;
}

extension GroupListEntityExtension on GroupListEntity {
  GroupListEntity copyWith({
    String? name,
    String? photo,
    String? account,
    String? lastmsg,
    String? time,
    int? time2,
    String? sessionId,
    int? unread,
  }) {
    return GroupListEntity()
      ..name = name ?? this.name
      ..photo = photo ?? this.photo
      ..account = account ?? this.account
      ..lastmsg = lastmsg ?? this.lastmsg
      ..time = time ?? this.time
      ..time2 = time2 ?? this.time2
      ..sessionId = sessionId ?? this.sessionId
      ..unread = unread ?? this.unread;
  }
}